package com.jinsi.service.tang.iml;


import com.jinsi.constant.TangConstant;
import com.jinsi.mapper.tang.ProductAddMapper;
import com.jinsi.pojo.Commodity;
import com.jinsi.pojo.SyUser;
import com.jinsi.service.tang.ProductAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpSession;
import java.util.Date;

/**
 * 添加商品列表
 * @author 唐文博
 * @Date 2022-08-05
 */
@Service
@Transactional
public class ProductAddServiceImpl implements ProductAddService {
    @Autowired
    private ProductAddMapper productAddMapper;
    /**
     * 添加数据
     * @param commodityCode
     * @param classifyId
     * @param commodityName
     * @param searchKeywords
     * @param commodityImage
     * @param currentPrice
     * @param commodityState
     * @param commodityLabel
     * @param recommend
     * @param commodityIsdel
     * @param createUser
     * @param createDate
     * @param commodityExamine
     * @param commodityJournal
     */
    @Override
    public void addCommodity(int commodityCode, int classifyId, String commodityName, String searchKeywords,
                             String commodityImage, int currentPrice, int commodityState, String commodityLabel,
                             int recommend, Integer commodityIsdel,Integer createUser, Date createDate,
                             Integer commodityExamine, Integer commodityJournal) {
        productAddMapper.addCommodity(commodityCode,classifyId,commodityName,searchKeywords,
                commodityImage, currentPrice,commodityState,commodityLabel, recommend,
                commodityIsdel,createUser,createDate, commodityExamine, commodityJournal);
    }


    /**
     * 商品删除 假删除
     * @param commodityId
     */
    @Override
    public void deleteCommodity(Integer commodityId) {
        productAddMapper.deleteCommodity(commodityId,TangConstant.COMMODITY_ISDELETE,TangConstant.COMMODITY_STATE);
    }
}
